﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Ymca.DataAccess.Interfaces;
using Ymca.Entities;

namespace Ymca.DataAccess
{
	public class DataContext: DbContext, IDataContext
	{
		public DbSet<UserProfile> UserProfiles { get; set; }
		public DbSet<Post> Posts { get; set; }
		public DbSet<Comment> Comments { get; set; }
		public DbSet<GalleryGroup> GalleryGroups { get; set; }
		public DbSet<GalleryItem> GalleryItems { get; set; }
		public DbSet<ContentValue> ContentValues { get; set; }

		public DataContext()
            : base("YmcaConnectionString")
		{
			Configuration.LazyLoadingEnabled = false;
		}

		public void Save()
		{
			SaveChanges();
		}

		protected override void Dispose(bool disposing)
		{
			Save();
			base.Dispose();
		}
	}
}
